/**
 * 
 */
package kr.co.insoft.publicmesh.controller.template.application;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import kr.co.insoft.core.model.template.application.ApplicationEntityModel;
import kr.co.insoft.core.model.template.application.EventEntityModel;
import kr.co.insoft.core.model.template.application.FileEntityModel;
import kr.co.insoft.core.service.template.application.ApplicationService;
import kr.co.insoft.core.service.template.application.EventService;
import kr.co.insoft.core.service.template.script.ScriptService;
import kr.co.insoft.framework.exceptions.ServiceException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author IN-SOFT Inc. Park Jong Taek(jtpark@in-soft.co.kr)
 * 
 */
@Controller
@RequestMapping(value = "template/file")
public class FileController {

	private static final Logger logger = LoggerFactory
			.getLogger(EventController.class);
	
	final String TILES_PAGE_PREFIX = "tiles/template/application/file";
	final String SINGLE_PAGE_PREFIX = "template/application/file";

	/**
	 * File 등록화면
	 * 
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "createForm", method = RequestMethod.GET)
	public String createForm(
			Model model,
			@RequestParam(value = "applicationid", required = true) String applicationid,
			@RequestParam(value = "ip", defaultValue = "Y", required = false) String ip)  throws ServiceException  {
		
		model.addAttribute(new FileEntityModel());
		
		if (ip.equals("Y"))
			return SINGLE_PAGE_PREFIX+"/createForm";
		
		return TILES_PAGE_PREFIX + "/createForm";
	}

}
